Kinetis SDK Demo Applications User Guide  1.0.0-beta
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
low_power_adc.c File Reference
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "low_power_adc.h"
#include "fsl_clock_manager.h"
#include "fsl_gpio_driver.h"
#include "fsl_adc_driver.h"
#include "fsl_device_registers.h"
#include "fsl_adc_hal.h"
#include "fsl_smc_manager.h"
#include "fsl_smc_hal.h"
#include "fsl_sim_hal.h"
#include "fsl_pit_driver.h"
#include "fsl_interrupt_manager.h"
#include "board.h"

Macros

#define ADC_1
 
#define MUXGROUP_0
 
#define LED_ON
 
#define LED_OFF
 
#define VTEMP25_ADC
 These values are used to get the temperature. DO NOT MODIFY. More...
 
#define K
 
#define M1
 
#define M2
 
#define UPPER_VALUE_LIMIT
 
#define LOWER_VALUE_LIMIT
 
#define LPTMR_COMPARE_VALUE
 
#define UPDATE_BOUNDARIES_TIME
 

Functions

void init_hardware (void)
 Initialize Clock Manager for PORT, ADC, and LPTIMER. More...
 
void LowPowerTimerIRQHandler (void)
 Low Power Timer Interrupt handler. Clear LPT Compare flag. More...
 
void InitLowPowerTmr (void)
 Initialize Low Power Timer. Use 1 kHz LPO with no preescaler and enable LPT interrupt. More...
 
void ADC1IRQHandler (void)
 ADC Interrupt handler. Get current ADC value and set conversionCompleted flag. More...
 
uint32_t GetCurrentTempValue (void)
 Calculate current temperature. More...
 
lowPowerAdcBoundaries_t TempSensorCalibration (uint32_t updateBoundariesCounter, uint32_t *tempArray)
 Calculate current temperature. More...
 
void main (void)
 

Variables

static uint32_t adcValue
 
volatile bool conversionCompleted
 

Macro Definition Documentation

#define ADC_1
#define K
#define LED_OFF
#define LED_ON
#define LOWER_VALUE_LIMIT
#define LPTMR_COMPARE_VALUE
#define M1
#define M2
#define MUXGROUP_0
#define UPDATE_BOUNDARIES_TIME
#define UPPER_VALUE_LIMIT
#define VTEMP25_ADC

Function Documentation

void ADC1IRQHandler ( void  )
uint32_t GetCurrentTempValue ( void  )
Returns
uint32_t Returns current temperature.
void init_hardware ( void  )

Conversion is completed Flag

void InitLowPowerTmr ( void  )
void LowPowerTimerIRQHandler ( void  )
void main ( void  )
lowPowerAdcBoundaries_t TempSensorCalibration ( uint32_t  updateBoundariesCounter,
uint32_t *  tempArray 
)
Parameters
updateBoundariesCounterIndicate number of values into tempArray.
tempArrayStore temperature value.
Returns
lowPowerAdcBoundaries_t Returns upper and lower temperature boundaries.

Variable Documentation

uint32_t adcValue
static
volatile bool conversionCompleted

ADC value